home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
SourceCode
/
AdobeExamples
/
NX_ImportAdv
/
rotateprocs.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-19
|
3KB
|
87 lines
/*
* (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
*
* (b) If this Sample Code is distributed as part of the Display PostScript
* System Software Development Kit from Adobe Systems Incorporated,
* then this copy is designated as Development Software and its use is
* subject to the terms of the License Agreement attached to such Kit.
*
* (c) If this Sample Code is distributed independently, then the following
* terms apply:
*
* (d) This file may be freely copied and redistributed as long as:
* 1) Parts (a), (d), (e) and (f) continue to be included in the file,
* 2) If the file has been modified in any way, a notice of such
* modification is conspicuously indicated.
*
* (e) PostScript, Display PostScript, and Adobe are registered trademarks of
* Adobe Systems Incorporated.
*
* (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
* CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
* AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
* ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
* OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
* WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
* WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
* DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS.
*/
/*
* rotateprocs.h
*
* The header file for the procedures for rotated graphic operations.
*/
/*
* If alternate key is down, constrain every 15 degrees.
* (2 pi div 24 = pi div 12) see ConstrainPointToAngle()
*/
#define ANGLES 12.0
#define ANGLE (180/M_PI)
/*
* Takes the point passed in, rotates it around the point
* at the angle given and returns the new point.
* The new point replaces the old one and its address
* is returned as the return value.
*/
extern NXPoint *RotatePoint(NXPoint *aPoint, NXPoint *cPoint, float angle);
/*
* Checks whether the point passed in lies in the rectangle
* rotated about its lower left vertice at the angle provided.
* Returns either YES or NO. Assumes an unflipped
* coordinate system.
*/
extern BOOL MouseInRotatedRect(NXPoint *aPoint, NXRect *aRect, float angle);
/*
* This procedure takes the unrotated rectangle, bRect,
* rotates it around the point, cPoint, at the angle, angle,
* and places the new bounding box that encloses the
* rotated rectangle in the rectangle aRect. The address
* of the new rectangle is returned as the return value.
*/
NXRect *RotateRectBounds(NXRect *aRect, const NXRect *bRect,
NXPoint *cPoint, float angle);
/*
* This procedure takes two rectangles and an angle.
* It checks if the second rectangle rotated about its center
* at the given angle intersects the first rectangle. The
* first rectangle is unrotated.
*/
extern BOOL IntersectsRotatedRect(NXRect *aRect, NXRect *bRect, float angle);
/*
* This procedure takes two points and constrains the first
* point to the nearest interval for the angle passed in.
*/
extern void ConstrainPointToAngle(NXPoint *aPoint, NXPoint *bPoint, float angle);